# 字符串重复统计
# 字符表'abcdefghijklmnopqrstuvwxyz'
# 随机挑选2个字母组成字符串，共挑选100个
# 降序输出所有不同的字符串及重复的次数
import random

s = 'abcdefghijklmnopqrstuvwxyz'
ss = ["".join(random.choices(s,k=2)) for i in range(100)]
ss_set = set(ss)
ss_dict = dict.fromkeys(ss_set, 0)
for i in ss:
    ss_dict[i] += 1

ss_sort = sorted(ss_dict.items(), key=lambda ss:ss[1], reverse=True)
print(ss_sort)

# 做得不错
